﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using K.EnterpriseLibary.Entity;
using K.Presentation;
namespace CreateDictionaryWeb.UserControl
{
    public partial class CharacterControl : System.Web.UI.UserControl
    {
        private ChineseDictAction chineseDictAction = new ChineseDictAction();
        
        private Character character;
        public Character Character
        {
            get
            {
                character = new Character();
                character.Font = lbCharacter.Text;
                character.Radicals = tbRadicals.Text;
                character.StrokeCount = tbStrokeCount.Text == "" ? 0 : Convert.ToInt32(tbStrokeCount.Text);
                return character;
            }
            set
            {
                if (value != null)
                {
                    lbCharacter.Text = value.Font;
                    tbRadicals.Text = value.Radicals;
                    tbStrokeCount.Text = value.StrokeCount.ToString();
                }
            }
        }
        
        protected void Page_Load(object sender, EventArgs e)
        {
            //lbCharacter.Text = character.Font;
            
        }

        protected void btSaveCharater_Click(object sender, EventArgs e)
        {
            chineseDictAction.UpdateCharacter(character);
        }
    }
}